package com.hackerrank.www.javap;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

/**
 * Created by 27340 on 2017/5/14.
 */
public class DateTime {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String month = in.next();
        String day = in.next();
        String year = in.next();
        Calendar c = Calendar.getInstance();
        c.set(Integer.parseInt(year), Integer.parseInt(month)-1, Integer.parseInt(day));
        if(Calendar.MONDAY== c.get(Calendar.DAY_OF_WEEK))
            System.out.println("MONDAY");
        else if(Calendar.TUESDAY== c.get(Calendar.DAY_OF_WEEK))
            System.out.println("TUESDAY");
        else if(Calendar.WEDNESDAY== c.get(Calendar.DAY_OF_WEEK))
            System.out.println("WEDNESDAY");
        else if(Calendar.THURSDAY== c.get(Calendar.DAY_OF_WEEK))
            System.out.println("THURSDAY");
        else if(Calendar.FRIDAY== c.get(Calendar.DAY_OF_WEEK))
            System.out.println("FRIDAY");
        else if(Calendar.SATURDAY== c.get(Calendar.DAY_OF_WEEK))
            System.out.println("SATURDAY");
        else if(Calendar.SUNDAY== c.get(Calendar.DAY_OF_WEEK))
            System.out.println("SUNDAY");
    }
}
